/*****************************************************************************
 * (C) Copyright 2013 Atech-Automotive
 * FILE NAME:    diag_fun.c
 * DESCRIPTION:  
 * DATE BEGUN:   Feb 2013
 * BY:           Allen Feng
 * PRODUCT NAME:ZOTYE  B11 BCM
 * APPLICATION:  
 * TARGET H/W:   
 * DOC REF:
 *****************************************************************************
 */

#define diag_fun_c




/* #include */
#include "sys_micro.h"
#include "system.h"
#include "hwa_inputs.h"
#include "hwa_outputs.h"
#include "diag.h"
#include "diag_fun.h"
//#include "Driver_a2d.h"

#include "app_canNwm.h"

//#include "hwa_lsdArray.h"
/* #define */




//#define HSD_DIAG_L_TH_HORN	20
//#define HSD_DIAG_H_TH_HORN	170
//#define HSD_DELAY_HORN		40	//400ms

//#define HSD_DIAG_RELAY	180

//#define RELAY_DIAG_DELAY		20	//200ms

//#define LSD_DIAG_DELAY		    10	// 100ms
//#define LSD_DIAG_DELAY_DOME		50	// 100ms

/* Macros */

/* typedef */

/* static variables */

VBATDiagInfo   VBATDiag;
TemperDiagInfo   TemperatureSensorDiag;
//HSDDiagInfo   RLockHSDDiag;
//LSDDiagInfo   RearDefr_LSDDiag;

/* static constants */

/* static function prototypes */
/*****************************************************************************/
/**
 * Function Name: checkDiags
 * Description:  check all the diagnostics
 *
 * Param:   none
 * Return:  none
 * Author:  AF
 * *****************************************************************************/
void checkDiags(void)
{
//    check_VBAT(&VBATDiag , hwa_inputsGetVBatCurrent());
//	check_Temprature(&TemperatureSensorDiag , hwa_inputsGetVTempCurrent());
   // checkHSD( &HornHSDDiag,      HWA_GetVoltage(SA_HORN_DIAG_AN),HWA_GetOutputStatus(SO_HORN_OUT),(Byte*)&s_outputStatus[SO_HORN_OUT].b_overCurrentStatus);
   // checkRelay(&LLockHSDDiag , HWA_GetVoltage(SA_L_LOCK_DIAG_AN) , HWA_GetOutputStatus(SO_L_LOCK_OUT)|| HWA_GetOutputStatus(SO_L_UNLOCK_OUT));
   // checkRelay(&RLockHSDDiag , HWA_GetVoltage(SA_R_LOCK_DIAG_AN) , HWA_GetOutputStatus(SO_R_LOCK_OUT)|| HWA_GetOutputStatus(SO_R_UNLOCK_OUT));
  //  checkLSD(&RearDefr_LSDDiag,    !PORTC_PC4,   HWA_GetOutputStatus(SO_R_MIRROR_DEF_OUT), (Byte*)&s_outputStatus[SO_R_MIRROR_DEF_OUT].b_overCurrentStatus);
}
	
/*****************************************************************************/
/**
 * Function Name: configDiags
 * Description:  config DTC enable or not according to config data
 *
 * Param:   none
 * Return:  none
 * Author:  AF
 * *****************************************************************************/
void configDiags(void)
{
    UINT8 i;
         for(i = 0;i < NUM_OF_DTCS;i++)
         {
             dtcStatus[i].enable = TRUE;
         }

}

/*****************************************************************************/
/**
 * Function Name: iniDiagStatus
 * Description:  ini data for all diag structures
 *
 * Param:   none
 * Return:  none
 * Author:  AF
 * *****************************************************************************/
void iniDiagStatus(void)
{
        iniVBATDiag(&VBATDiag);
       // iniHSDDiag(&HornHSDDiag,HSD_DIAG_L_TH_HORN,HSD_DIAG_H_TH_HORN,HSD_DELAY_HORN);
      //  iniLSDDiag(&RearDefr_LSDDiag,LSD_DIAG_DELAY_DOME );
      //  iniHSDDiag(&LLockHSDDiag,0,HSD_DIAG_RELAY,RELAY_DIAG_DELAY);
      //  iniHSDDiag(&RLockHSDDiag,0,HSD_DIAG_RELAY,RELAY_DIAG_DELAY);
}


